package com.globalwave.common.service;

import com.globalwave.base.BaseServiceImpl;
import com.globalwave.common.ArrayOrderList;
import com.globalwave.common.ArrayPageList;
import com.globalwave.common.entity.SyncColumns;
import com.globalwave.common.entity.SyncColumnsCriterion;

public class SyncColumnsServiceImpl 
       extends BaseServiceImpl 
       implements SyncColumnsService {

    public SyncColumns create(SyncColumns syncColumns) throws Exception {
        return (SyncColumns) jdbcDao.insert(syncColumns);
    }

    public void update(SyncColumns syncColumns) throws Exception {
        jdbcDao.update(syncColumns) ;
    }

    public void delete(SyncColumns syncColumns) throws Exception {
        // delete cascade 
        //OrganizationSyncColumns orgSyncColumns = new OrganizationSyncColumns() ;
        //orgSyncColumns.setSyncColumns_id(syncColumns.getSyncColumns_id()) ;
        //jdbcDao.delete(OrganizationSyncColumns.class, orgSyncColumns) ;
        
        jdbcDao.delete(syncColumns) ;
        
    }

    public void deleteAll(Long[] ids) throws Exception {
        SyncColumnsCriterion criterion = new SyncColumnsCriterion() ;
        criterion.setIds(ids) ;
        jdbcDao.delete(SyncColumns.class, criterion) ;
        
    }

    public ArrayPageList<SyncColumns> query(
            SyncColumnsCriterion criterion, 
            int pageIndex, 
            int pageSize, 
            ArrayOrderList orderList) throws Exception {
        
        if (orderList == null) {
            orderList = new ArrayOrderList() ;
            //orderList.addAsc("syncColumns_id") ;
        }
        
        return (ArrayPageList<SyncColumns>)jdbcDao.query(criterion, pageIndex, pageSize, orderList, SyncColumns.class);
    }


    
}
